package com.xyzwps.example.chain;

import java.util.Collection;
import java.util.function.Function;

public record SingleChain<T>(T value) {

    public <R> SingleChain<R> map(Function<T, R> fn) {
        return new SingleChain<>(fn.apply(value));
    }

    public <R> CollectionChain<R> flatMap(Function<T, Collection<R>> fn) {
        return new CollectionChain<>(fn.apply(value));
    }
}
